I would write the table in DXL, then import it. There is sample code
here, though not for a table. To merge cells, you write tags like: <tablecell columnspan='2'> and <tablecell rowspan='4'>. Designer Help defines all the tags and has examples. You can make more examples of your own by exporting test documents.